<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>SampleDNS</title>
</head>
<style>
    div {
        text-indent: 25px;
        margin-top: 10px;
    }

    .inputText {
        width: 25%;
    }

    input {

    }
</style>

<script src="js/jquery.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
    function addDnsInfo() {
        $.ajax({
            type: "POST",
            url: "/add",
            data: {
                'DomanName': DomanName.value,
                'Type': $("input[name='Type']:checked").val(),
                'IP': IP.value,
                'Remark': Remark.value
            },
            dataType: "JSON",
            success: function (data) {
                if (data.code == 0) {
                    alert("DNS记录添加成功");
                    window.location.href="index.html";
                } else {
                    alert("DNS记录添加失败");
                    window.location.href="index.html";
                }
                setTimeout(function () {
                    window.parent.location.reload();
                }, 1000);
            }, error: function (data) {
                alert("DNS记录添加失败");
                window.location.href="index.html";
            }
        })
    }

</script>
<body>
    <div class="container">
            <div>
                <label>域名: </label>
                </label><input type="text" id="DomanName" name="DomanName" placeholder="请输入域名" class="inputText">
            </div>
        <div>
            <label>类型: </label>
            <label><input type="radio"  name="Type" value="A">A记录</label>
            <label><input type="radio"  name="Type" value="AAAA">AAAA记录</label>
            <label><input type="radio"  name="Type" value="NS">NS记录</label>
            <label><input type="radio"  name="Type" value="MX">MX记录</label>
            <label><input type="radio"  name="Type" value="CNAME">CNAME记录</label>
        </div>

        <div>
            <label>解析: </label>
            </label><input type="text" id="IP" name="IP" placeholder="解析地址" class="inputText">
        </div>

        <div>
            <label>备注: </label>
            </label><input type="Remark" id="Remark" name="Remark" placeholder="备注" class="inputText">
        </div>

        <div>
            <button id="upload" onclick="addDnsInfo()">添加记录</button>
        </div>
    </div>
</body>
</html>